package com.cq.hd.product.mapper;

import com.cq.hd.product.api.dto.GoodsActivePageDto;
import com.cq.hd.product.api.dto.GoodsPageDto;
import com.cq.hd.product.api.vo.GoodsActivePageVo;
import com.cq.hd.product.api.vo.GoodsPageVo;
import com.cq.hd.product.po.TbGoodsPo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 商品表 Mapper 接口
 * </p>
 *
 * @author mYunYu
 * @since 2023-11-23
 */
@Mapper
public interface TbGoodsMapper extends BaseMapper<TbGoodsPo> {

    List<GoodsPageVo> listGoodsByDto(GoodsPageDto goodsPageDto);

    List<GoodsActivePageVo> listGoodsActiveByDto(GoodsActivePageDto goodsActivePageDto);

    int subStock(@Param("id") long id, @Param("goodsNum") Integer goodsNum);

    int addStock(@Param("id") Long id, @Param("goodsNum") Integer goodsNum);

    int offGoods(TbGoodsPo tbGoodsPo);

    int onGoods(TbGoodsPo tbGoodsPo);
}
